/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Lucas
 */
@Entity
@Table(name = "CURRICULO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Curriculo.findAll", query = "SELECT c FROM Curriculo c"),
    @NamedQuery(name = "Curriculo.findByCurriculoid", query = "SELECT c FROM Curriculo c WHERE c.curriculoid = :curriculoid"),
    @NamedQuery(name = "Curriculo.findByAno", query = "SELECT c FROM Curriculo c WHERE c.ano = :ano")})
public class Curriculo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CURRICULOID")
    private Integer curriculoid;
    @Column(name = "ANO")
    private Integer ano;
    @JoinTable(name = "OBRIGATORIA", joinColumns = {
        @JoinColumn(name = "CURSOID", referencedColumnName = "CURRICULOID")}, inverseJoinColumns = {
        @JoinColumn(name = "DISCIPLINAID", referencedColumnName = "CODIGO")})
    @ManyToMany
    private Collection<Disciplina> disciplinaCollection;
    @JoinColumn(name = "CURSO", referencedColumnName = "CURSOID")
    @ManyToOne
    private Curso curso;
    @OneToMany(mappedBy = "curriculoid")
    private Collection<Usuario> usuarioCollection;

    public Curriculo() {
    }

    public Curriculo(Integer curriculoid) {
        this.curriculoid = curriculoid;
    }

    public Integer getCurriculoid() {
        return curriculoid;
    }

    public void setCurriculoid(Integer curriculoid) {
        this.curriculoid = curriculoid;
    }

    public Integer getAno() {
        return ano;
    }

    public void setAno(Integer ano) {
        this.ano = ano;
    }

    @XmlTransient
    public Collection<Disciplina> getDisciplinaCollection() {
        return disciplinaCollection;
    }

    public void setDisciplinaCollection(Collection<Disciplina> disciplinaCollection) {
        this.disciplinaCollection = disciplinaCollection;
    }

    public Curso getCurso() {
        return curso;
    }

    public void setCurso(Curso curso) {
        this.curso = curso;
    }

    @XmlTransient
    public Collection<Usuario> getUsuarioCollection() {
        return usuarioCollection;
    }

    public void setUsuarioCollection(Collection<Usuario> usuarioCollection) {
        this.usuarioCollection = usuarioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (curriculoid != null ? curriculoid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Curriculo)) {
            return false;
        }
        Curriculo other = (Curriculo) object;
        if ((this.curriculoid == null && other.curriculoid != null) || (this.curriculoid != null && !this.curriculoid.equals(other.curriculoid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Curriculo[ curriculoid=" + curriculoid + " ]";
    }
    
}
